import request from '@/utils/request'


/**
 * 增加部门信息
 * @param {Object} data
 */
export function addDepartmentInfo(data) {
	return request({
		url: `/admin/v1/department/`,
		method: 'post',
		data
	})
}

/**
 * 修改部门信息
 * @param {Object} data
 */
export function modifyDepartmentInfo(data) {
	return request({
		url: `/admin/v1/department/${data.departmentId}`,
		method: 'put',
		data
	})
}

/**
 * 删除部门
 * @param {Object} departmentId
 */
export function deleteDepartmentInfo(departmentId) {
	return request({
		url: `/admin/v1/department/${departmentId}`,
		method: 'delete'
	})
}

/**
 * 获取部门树
 */
export function getDepartmentTreeInfo() {
	return request({
		url: '/admin/v1/department/tree',
		method: 'get'
	})
}

/**
 * 通过父ID 获取第一层子节点
 * @param {Object} parentsId
 */
export function getDepartmentInfoByParentsId(data) {
	return request({
		url: `/admin/v1/department/${data.departmentId}/${data.page}/${data.size}`,
		method: 'get'
	})
}


/**
 * 通过父ID 获取第一层子节点
 * @param {Object} parentsId
 */
export function searchDepartmentInfo(data) {
	return request({
		url: `/admin/v1/department/search`,
		method: 'post',
		data
	})
}
